<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>找回密码 <!--{$site.title}-->_<!--{$site.seotitle}--></title>
    <meta name="keywords" content="<!--{$site.keywords}-->" />
    <meta name="description" content="<!--{$site.description}-->"/>
    <meta name="mobile-agent" content="format=xhtml;url=<!--{$site.urls.mobile}-->">
    <meta name="mobile-agent" content="format=html5;url=<!--{$site.urls.mobile}-->"/>
    <!--{iCMS:public:ui}-->
    <link rel="stylesheet" href="<!--{$site.urls.tpl}-->/static/css/user.css" type="text/css" />
    <script>
    $(function(){
      var findpwd = $("#findpwd-box");
      $("#findpwd-submit").click(function(event) {
        event.preventDefault();
        $(".tip-error").hide();
        var param = {
            uname: $("#uname", findpwd).val(),
            seccode: $("#seccode", findpwd).val()
        }

        if (!param.uname) {
          tip({
              forward: 'uname',
              msg: '请填写您注册时所用的邮箱！'
          });
          return false
        }
        var pattern = /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9._-])+/;
        if (!pattern.test(param.uname)) {
          tip({
              forward: 'uname',
              msg: '电子邮箱格式不正确！'
          });
          return false;
        }
        if (param.seccode == "") {
            tip({
                forward: 'seccode',
                msg: '请输入验证码'
            });
            return false
        }
        //找回密码接口
        iCMS.run('passport', function($PASSPORT) {
            //成功 事件绑定
            $PASSPORT.SUCCESS = function(s) {
              iCMS.UI.alert(s.msg);
            }
            //失败 事件绑定
            $PASSPORT.FAIL = function(f) {
              tip(f);
            }
            //提交参数
            $PASSPORT.FINDPWD(param);
        });
      });
      //提示
      function tip(ret) {
          iCMS.UI.seccode(".seccode-img", findpwd);
          var tip = $('.tip-' + ret.forward);
          tip.text(ret.msg).show();
      }
    })
    </script>
  </head>
  <body class="userApp passport">
    <!--{include file="./user.header.htm" import="true"}-->
    <div class="findpwd-wrap">
      <div class="passport-wrap">
        <div class="passport-main">
          <h1>找回密码</h1>
          <div id="findpwd-box" class="passport-form form-horizontal">
            <div class="form-group">
              <label for="uname" class="control-label">邮箱：</label>
              <input type="text" name="uname" class="form-control" id="uname" placeholder="请填写你注册时所用的邮箱">
              <p class="help-block tip-error tip-uname tip-mail">请填写你注册时所用的邮箱</p>
            </div>
            <div class="form-group">
              <label for="seccode" class="control-label">验证码：</label>
              <input type="text" maxlength="4" name="seccode" class="seccode form-control" id="seccode" placeholder="请输入验证码">
              <!--{iCMS:public:seccode}-->
              <p class="help-block tip-error tip-seccode">请输入验证码</p>
            </div>
            <div class="form-group submit">
              <button class="btn btn-large btn-primary" id="findpwd-submit" type="button">提 交</button>
            </div>
          </div>
        </div>
        <div class="passport-right">
            <div class="right-wrap">
                <h2>已经有帐号？请直接登录</h2>
                <a class="btn btn-primary" href="<!--{iCMS:router url='user:login' query="$query"}-->">登 录</a>
                <div class="other_login">
                    <p>您也可以用以下方式登录：</p>
                    <!--{if $iCMS.CONFIG.user.open.QQ.enable }-->
                    <a class="open_icon icon_qq" href="<!--{iCMS:router url='user:login:qq'}-->">QQ 帐号</a>
                    <!--{/if}-->
                    <!--{if $iCMS.CONFIG.user.open.WB.enable }-->
                    <a class="open_icon icon_wb" href="<!--{iCMS:router url='user:login:wb'}-->">新浪微博</a>
                    <!--{/if}-->
                    <!--{if $iCMS.CONFIG.user.open.WX.enable }-->
                    <a class="open_icon icon_wx" href="<!--{iCMS:router url='user:login:wx'}-->">微信账号</a>
                    <!--{/if}-->
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
      </div>
    </div>
    <!--{include file="iCMS://footer.htm"}-->
  </body>
</html>
